<!DOCTYPE html>
<!-- saved from url=(0037)http://127.0.0.1/wx/ybss/zhuce/zc.jsp -->
<html class="pixel-ratio-1"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
  <title>登录</title>

  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no, email=no">
  <!--[if IE]>
  <script src="http://127.0.0.1:80/wx/ybss/js/html5shiv.min.js"></script>
  <![endif]-->

  <link href="resource/style.css" rel="stylesheet" type="text/css">



  <script src="resource/jquery214.js"></script>
  <script src="resource/fastclick.js"></script>
  <script src="resource/jqueryweui.js"></script>
  <script src="resource/zeptomin.js">
  </script><script src="resource/picker.js"></script>
  <script src="../../script/api.js"></script>
  <script>

    var timer = null;
    var countdown=60;
    function settime(val) {
      if (countdown == 0) {
        val.removeAttribute("disabled");
        val.value="免费获取验证码";
        countdown = 60;
        $("#yzm").val("");
        window.clearTimeout(timer);
      } else {
        val.setAttribute("disabled", true);
        val.value="重新发送(" + countdown + ")";
        countdown--;
        timer = setTimeout(function() {
          settime(val);
        },1000);

      }

    }

    function getYzm(e){

      if($("#phone").val()!=null||$("#phone").val()!=null){
        var phone = $("#phone").val();
        console.info(phone);
        if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){//验证手机号
          alert("输入正确手机号");
          return false;
        }
        settime(e);
        jQuery.ajax({
          url:'http://wechat.scjinsui.com/weixin/app/getyzm.do',
          type:'post',
          data:{phone:phone},
          dataType:'json',
          error:function(xhr, textStatus, errorThrown){
            console.log(xhr + "服务请求错误,请联系管理员【错误代码："+xhr.status+"】" + errorThrown);
          },
          success:function(data){

            $("#yzm").val(data);
            alert("验证码已发送，请稍候")
          }
        });}else{
        alert("请先输入手机号码")
      }
    }
  </script>

  <style>
    .logo-license{margin-top:0px;}
    .left{font-weight:bold;}
    .info {margin-top: 5rem;}
    .btn-1 a {
      width: 90%;
      outline: none;
      border: none;
      background: #18b4ed;
      color: #fff;
      height: 5rem;
      line-height: 5rem;
      display: inline-block;
      border-radius: 0.4rem;
      font-size: 2rem;
    }

    .weui_cells_form input, .weui_cells_form label[for], .weui_cells_form textarea {
      -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    .weui_uploader_input {
      position: absolute;
      z-index: 1;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      opacity: 0;
      -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    .weui_uploader_input_wrp {
      float: left;
      position: relative;
      margin-right: 9px;
      margin-bottom: 9px;
      width: 77px;
      height: 77px;
      border: 1px solid #d9d9d9;
    }
    .weui_uploader_files {
      list-style: none;
    }
    .weui_uploader_file {
      font-size: 12px;
      color: #333;
      text-align: center;
      display: table-cell;
      vertical-align: middle;
      display: table;
    }
    .weui_uploader_file {
      float: left;
      margin-right: 9px;
      margin-bottom: 9px;
      width: 79px;
      height: 79px;
      background: no-repeat 50%;
      background-size: cover;
    }

    .info ul li .weui_uploader_files{
      width:99px;
      height:99px;
    }
    .js_file1_show,.js_file2_show,.js_file3_show{display:none;}
    #ssk{background-color:#FFFFFF;width: 93%;height: 5rem;font-size:2rem;}
    /*地址样式*/
    #divselect .all li{line-height:2rem;padding:5px 1rem;text-indent:0;}
  </style>

</head>
<body style="background:#FFF;">
<header>
<span style="text-align: center;width: 100%;margin: 0 auto;">注   册  信   息</span>
  <div style="clear:both"></div>
</header>

<form id="form" method="post" enctype="multipart/form-data">


  <article class="info">
    <ul>

      <li>
        <div class="left">
          手机号:
        </div>
        <div class="right">
          <input id="phone" name="phone" placeholder="请输入手机号">
          
        </div>
        <div class="clear"></div>
      </li>
      <li>
        <div class="left">
          <input id="yzmhq" type="button" name="yzmhq" value="获取验证码" onclick="getYzm(this)">
          <input id="yzm" type="hidden" name="yzm">
        </div>
        <div class="right">
          <input id="yzmtx" name="yzmtx" placeholder="输入手机验证码">
        </div>
        <div class="clear"></div>
      </li>
      <li>
        <div class="left">
          电子邮箱:
        </div>
        <div class="right">
          <input id="email" name="email" placeholder="请输入电子邮箱">
        </div>
        <div class="clear"></div>
      </li>

    </ul>
  </article>
  <article class="btn-1">

    <a onclick="zc()" style="width:80%;">注   册</a>

  </article>
</form>

<script>


  function check0(){
   var phone = document.getElementById("phone").value;
 var email = document.getElementById("email").value;
//  var possword = document.getElementById("possword").value;
// 
//  var possword1 = document.getElementById("possword1").value;
    var yzm = document.getElementById("yzm").value;
    var yzmtx = document.getElementById("yzmtx").value;
    
//  if(!(/^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(idnum))){
//    alert("请输入正确身份证号");
//    return false;
//  }
    if(yzm!=yzmtx){
      alert("请输入正确验证码");
      return false;
    }
    if(yzm==null||yzm==""){
      alert("验证码不能为空");
      return false;
    }
    console.info('email:' + email);
    if(email==null||email==""){
      alert("电子邮箱不能为空");
      return false;
    }
//  if(possword!=possword1){
//    alert("两次密码输入不一致，请确认");
//    return false;
//  }
//    if(sj=='0'){
//      alert("请先验证手机号")
//      return false;
//    }else if(sj=='2'){
//      alert("请手机号已存在")
//      return false;
//    }
//  if(possword==null||possword==""){
//    alert("输入密码名称");
//    return false;
//  }

    if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){//验证手机号
      alert("输入正确手机号");
      return false;
    }

    /* if(document.getElementById("addrid").value==null||document.getElementById("addrid").value==""){
     alert("请选择地址");
     return false;
     }*/
    return true;
  }


  function zc() {
  	 var phone = document.getElementById("phone").value;
 var email = document.getElementById("email").value;
    var a = check0();
    //  var b  = check1();
    if(a){
    		api.ajax({
    		url: 'http://wechat.scjinsui.com/weixin/app/zc.do',
    		method: 'post',
    		data: {
    		    values: {
    		        openid : api.deviceId,
    		        email : email,
    		        phone : phone
    		    }
   		 }
		}, function(ret, err) {
			console.info(JSON.stringify(ret));
  		  if (ret) {
    			//ret.id
    			$api.setStorage("loginid",ret.id);
//  			api.openWin({
//	                name: '返回到主页',
//	                url: '../../index.html'
//              });
				api.sendEvent({
	                name:'reloadIndex'
                });
                api.closeWin();
       		 }else{
       		 	api.alert({msg:'注册失败'});
       		 }
		});
    
    }
  }
var sj ='0';
  function yzsjh(){

    var phone = $("#phone").val();
    jQuery.ajax({
      url:'http://127.0.0.1:80/ybss/zcsjh.do',
      type:'post',
      data: {phone:phone},
      dataType:'json',
      error:function(xhr, textStatus, errorThrown){
        console.log(xhr + "服务请求错误,请联系管理员【错误代码："+xhr.status+"】" + errorThrown);
      },
      success:function(data){
        if(data.flag == "Y"){
          console.info(data);
          if(data.phone.length==0){
          api.alert({msg:'注册成功！'})
            //alert("手机号可以用")
            $("#phone").val();
             sj='1';

          }else{
            api.alert({msg:'此手机号码已注册！'})
            $("#phone").val("");
            sj='2';

          }
         // console.info(data.phone)
         /* var opts = "";
          $("#lc").html("");
          $("#hao").html("");
          opts = "<option value=\""+ "请选择" + "\">"+ "请选择" + "</option>";
          for(var i=0;i<data.lc.length;i++){


            opts += "<option value=\""+ data.lc[i].FWXZ8 + "\">"+ data.lc[i].FWXZ8 + "</option>";
        } */

        }
      }
    });
  }

</script>


</body></html>